import pygame
from Gun import Gun
import Control as c
from pygame.sprite import Group
from Statisctics import Statistic
from Score import Score

def run():

    pygame.init()
    screen = pygame.display.set_mode((700, 800))
    pygame.display.set_caption('Space Invaders')
    bg_color = (0, 0, 0)
    gun = Gun(screen )
    enemys = Group()
    bullets = Group()
    c.create_army(screen, enemys)
    stats = Statistic()
    score = Score(screen, stats)

    while True:
        if stats.run_game:
            c.events(gun, screen, bullets)
            gun.pos()
            c.draw(screen=screen, bg_color=bg_color, gun=gun, enemys=enemys, bullets=bullets, stats=stats, score=score)
            c.update_bullets(screen, stats, score, enemys, bullets)
            c.update_enemys(stats, screen, gun, enemys, bullets, score)

run()


